#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n, m;
int cnt[N];
int ans[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) {
    int x;
    cin >> x;
    for (int i = 1; i * i <= x; i++) {
      if (x % i == 0) {
        cnt[i]++;
        if (i * i != x) cnt[x / i]++;
      }
    }
  }
  rep(i, 1, 1000000) { ans[cnt[i]] = i; }
  per(i, n, 1) ans[i] = max(ans[i], ans[i + 1]);
  rep(i, 1, n) cout << ans[i] << endl;
  return 0;
}